blktap2: seperate blktap1/blktap2 disk types
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 6 Jul 2009 10:47:02 +0000 (11:47 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 6 Jul 2009 10:47:02 +0000 (11:47 +0100)
 * seperate blktap1/blktap2 disk types
 * use blktap1 when driver is not in explicit list of blktap2 drivers,
 * rather than current check against list of blktap1 only drivers
 * remove 'tapdisk' disk type (it is not a tapdisk disk type) and fix
 * tapdisk disk type check in XenConfig

Signed-off-by: Ryan O'Connor <rjo@cs.ubc.ca>
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/server/BlktapController.py

index fdff3adec3c1c111f14481529d68fcd4a04fe8a0..dc3e7501d48a4706140ff1cb25e6bd25d8ab1740 100644 (file)
@@ -1379,9 +1379,13 @@ class XendConfig(dict):
                 else:
                     # Save uname for next domain start.
                     dev_info['required_uname'] = dev_info['uname']
-                if dev_info['uname'].split(':')[1] not in blktap_disk_types:
+                tap_disk_type = dev_info['uname'].split(':')[1]
+                # tapdisk uname may be 'tap:<driver>' or 'tap:tapdisk:<driver>'
+                if tap_disk_type == 'tapdisk':
+                    tap_disk_type = dev_info['uname'].split(':')[2]
+                if tap_disk_type not in blktap_disk_types:
                     raise XendConfigError("tap:%s not a valid disk type" %
-                                    dev_info['uname'].split(':')[1])
+                                    tap_disk_type)
 
             if dev_type == 'vif':
                 if not dev_info.get('mac'):
index a05667c481948bb2574f87c09cfa5580b2989c85..40a6bfcaa0a90f4ac00f4e04a6840520d6740a5a 100644 (file)
@@ -13,17 +13,24 @@ TAPDISK_BINARY  = '/usr/sbin/tapdisk2'
 TAPDISK_DEVICE  = '/dev/xen/blktap-2/tapdev'
 TAPDISK_CONTROL = TAPDISK_SYSFS + '/blktap'
 
-blktap_disk_types = [
+blktap1_disk_types = set([
     'aio',
     'sync',
     'vmdk',
     'ram',
     'qcow',
     'qcow2',
-    'vhd',
     'ioemu',
-    'tapdisk',
-    ]
+    ])
+
+blktap2_disk_types = set([
+    'aio',
+    'ram',
+    'qcow',
+    'vhd',
+    ])
+
+blktap_disk_types = blktap1_disk_types | blktap2_disk_types
 
 def doexec(args, inputtext=None):
     """Execute a subprocess, then return its return code, stdout and stderr"""
@@ -151,7 +158,7 @@ class Blktap2Controller(BlktapController):
 
         if typ in ('tap'):
             if subtyp in ('tapdisk'):
-                if params in ('ioemu', 'qcow2', 'vmdk', 'sync') or not blktap2_installed:
+                if params not in blktap2_disk_types or not blktap2_installed:
                     # pass this device off to BlktapController
                     log.warn('WARNING: using deprecated blktap module')
                     self.deviceClass = 'tap'